/**
 * Reads the content of the file from the given location (parent folder path
 * relative to the companyhome).
 */
function main() {
	// get node to move
	var nodeRef = args.node;
	var node = search.findNode(nodeRef);
	
	// get destination node
	var targetNodeRef = args.target;
	var targetNode = search.findNode(targetNodeRef);
	
	// array that collects moved nodes
	var movedNodes=new Array();
	
	//move
	var success = node.move(targetNode);
	movedNodes.push(node.nodeRef);
	
	// handle attachments if required
	if(args.attachment){
		if(node.isDocument){
			var attachments=node.childAssocs["{http://www.uekae.tubitak.gov.tr/model/epdk/1.0}ekBelge"];
			if(attachments){
				for(var i=0;i<attachments.length;i++){
					// also move attachments
					attachments[i].move(targetNode);
					movedNodes.push(attachments[i].nodeRef);
				}
			}
		}
	}
	
	model.movednodes=jsonUtils.toJSONString(movedNodes);
}

main();